<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/lib/layui/css/layui.css" />
    <link rel="stylesheet" href="/css/sub-page.css">
    <title>招生简章</title>
</head>

<body>
<div class="ok-body">
    <blockquote class="layui-elem-quote">
        <button class="layui-btn layui-btn-danger" title="保存" id="save">保存</button>
    </blockquote>

    <textarea id="pageContent"></textarea>
</div>
<!--js逻辑-->
<script src="/lib/jquery/jquery-1.12.4.min.js"></script>
<script src="/lib/layui/layui.js"></script>
<script src="/lib/ckeditor/ckeditor.js"></script>
<script>
    layui.use('layer',function () {
        let layer = layui.layer;
        CKEDITOR.replace('pageContent');
        $.get('/manage/pages/manual',function (resp) {
            CKEDITOR.instances.pageContent.setData(resp.pageContent)
        },'json');

        $('#save').click(function () {
            let pageContent = CKEDITOR.instances.pageContent.getData();
            $.post('/manage/pages',{"pageCode":"manual","pageContent":pageContent},function (resp) {
                if(resp){
                    layui.layer.msg("执行成功！", {icon: 6, time: 1000, anim: 4});
                }else{
                    layui.layer.msg("执行失败！", {icon: 5, time: 1000, anim: 4});
                }
            })
        })
    })

</script>
</body>

</html>